<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ice="http://www.icesoft.com/icefaces/component"
      >

    <body>

        <ui:composition template="./../Template.xhtml">

            <ui:define name="title">
                Roles
            </ui:define>

            <ui:define name="body">
                <ice:form partialSubmit="true">
                    <ice:panelGroup id="messagePanel" layout="block">
                        <ice:messages errorClass="errorMessages" infoClass="infoMessages" globalOnly="true" layout="table"/>
                    </ice:panelGroup>
                    <ice:dataPaginator for="listaRoles" paginator="true" fastStep="3" paginatorMaxPages="5" style="border:none" >
                        <f:facet name="first">
                            <ice:graphicImage url="/Imagenes/Button First_128.png" style="border:none" title="Primera página" height="30px" />
                        </f:facet>
                        <f:facet name="previous">
                            <ice:graphicImage url="/Imagenes/Button Back_128.png" style="border:none" title="Página anterior" height="30px" />
                        </f:facet>
                        <f:facet name="next">
                            <ice:graphicImage url="/Imagenes/Button Play_128.png" style="border:none" title="Siguiente página" height="30px" />
                        </f:facet>
                        <f:facet name="last">
                            <ice:graphicImage url="/Imagenes/Button Last_128.png" style="border:none" title="Ultima página" height="30px" />
                        </f:facet>
                    </ice:dataPaginator>
                    <ice:dataTable styleClass="jsfcrud_list_form" id="listaRoles" rows="5" value="#{rol.rolItems}" var="item" border="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all">
                        <ice:column>
                            <f:facet name="header">
                                <ice:outputText value="Nombre"/>
                            </f:facet>
                            <ice:outputText value=" #{item.nombre}"/>
                        </ice:column>
                        <ice:column>
                            <f:facet name="header">
                                <ice:outputText escape="false" value="&nbsp;"/>
                            </f:facet>
                            <ice:outputText value=" "/>
                            <ice:commandLink title="Mostrar" action="#{rol.detailSetup}" >
                                <f:param name="jsfcrud.currentRol" value="#{jsfcrud_class['jsf.util.JsfUtil'].jsfcrud_method['getAsConvertedString'][item][rol.converter].jsfcrud_invoke}"/>
                                <ice:graphicImage height="20px" url="/Imagenes/Mostrar.png" />
                            </ice:commandLink>
                            <ice:commandLink title="Editar" action="#{rol.editSetup}" rendered="#{item.nombre != 'Administrador' and item.nombre != 'Usuario' and usuario.admin  }">
                                <f:param name="jsfcrud.currentRol" value="#{jsfcrud_class['jsf.util.JsfUtil'].jsfcrud_method['getAsConvertedString'][item][rol.converter].jsfcrud_invoke}"/>
                                <ice:graphicImage height="20px" url="/Imagenes/Editar.png" />
                            </ice:commandLink>
                            <ice:panelConfirmation id="deleteConfirmPanel" title="Eliminar" message="¿Estas seguro que quieres eliminar el rol?" acceptLabel="Si" cancelLabel="No"/>
                            <ice:commandLink title="Eliminar" action="#{rol.destroy}" panelConfirmation="deleteConfirmPanel" rendered="#{item.nombre != 'Administrador' and item.nombre != 'Usuario' and usuario.admin}">
                                <f:param name="jsfcrud.currentRol" value="#{jsfcrud_class['jsf.util.JsfUtil'].jsfcrud_method['getAsConvertedString'][item][rol.converter].jsfcrud_invoke}"/>
                                <ice:graphicImage height="20px" url="/Imagenes/Eliminar.png" />
                            </ice:commandLink>
                        </ice:column>
                    </ice:dataTable>
                    <ice:dataPaginator id="rolTableInfo" for="listaRoles"
                                       rowsCountVar="rowsCount"
                                       displayedRowsCountVar="displayedRowsCount"
                                       firstRowIndexVar="firstRowIndex"
                                       lastRowIndexVar="lastRowIndex"
                                       pageCountVar="pageCount"
                                       pageIndexVar="pageIndex"
                                       >
                        <ice:outputFormat value="{0} rol(es) encontrado(s), mostrando {1} rol(es), desde {2} a {3}. Página {4} / {5}.">
                            <f:param value="#{rowsCount}" />
                            <f:param value="#{displayedRowsCount}" />
                            <f:param value="#{firstRowIndex}" />
                            <f:param value="#{lastRowIndex}" />
                            <f:param value="#{pageIndex}" />
                            <f:param value="#{pageCount}" />
                        </ice:outputFormat>


                    </ice:dataPaginator>

                </ice:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
